package com.higgins.eventtracking.client.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@SuppressWarnings("serial")
public class QuestionDTO implements Serializable 	{
	private Date timestamp;
	private String category;
	private String question;
	private String answer;
	private String falseAnswerOne;
	private String falseAnswerTwo;
	private String falseAnswerThree;
	private String falseAnswerFour;
	private List<String> randomizedAnswers;
	private Integer correctAnswer;
	
	public QuestionDTO()	{
		
	}
	public QuestionDTO(String category, String question, String answer, String falseAnswerOne, String falseAnswerTwo, String falseAnswerThree, String falseAnswerFour)	{
		this.timestamp = new Date();
		this.category = category;
		this.question = question;
		this.answer = answer;
		this.falseAnswerOne = falseAnswerOne;
		this.falseAnswerTwo = falseAnswerTwo;
		this.falseAnswerThree = falseAnswerThree;
		this.falseAnswerFour = falseAnswerFour;
	}
	public QuestionDTO(Date timestamp, String category, String question, String answer, String falseAnswerOne, String falseAnswerTwo, String falseAnswerThree, String falseAnswerFour)	{
		this.timestamp = timestamp;
		this.category = category;
		this.question = question;
		this.answer = answer;
		this.falseAnswerOne = falseAnswerOne;
		this.falseAnswerTwo = falseAnswerTwo;
		this.falseAnswerThree = falseAnswerThree;
		this.falseAnswerFour = falseAnswerFour;
	}
	public void setTimestamp(Date timestamp)	{
		this.timestamp = timestamp;
	}
	public Date getTimestamp()	{
		return timestamp;
	}
	public void setCategory(String category)	{
		this.category = category;
	}
	public String getCategory()	{
		return category;
	}
	public void setQuestion(String question)	{
		this.question = question;
	}
	public String getQuestion()	{
		return question;
	}
	public void setAnswer(String answer)	{
		this.answer = answer;
	}
	public String getAnswer()	{
		return answer;
	}
	public void setFalseAnswerOne(String falseAnswerOne)	{
		this.falseAnswerOne = falseAnswerOne;
	}
	public String getFalseAnswerOne()	{
		return falseAnswerOne;
	}
	public void setFalseAnswerTwo(String falseAnswerTwo)	{
		this.falseAnswerTwo = falseAnswerTwo;
	}
	public String getFalseAnswerTwo()	{
		return falseAnswerTwo;
	}
	public void setFalseAnswerThree(String falseAnswerThree)	{
		this.falseAnswerThree = falseAnswerThree;
	}
	public String getFalseAnswerThree()	{
		return falseAnswerThree;
	}
	public void setFalseAnswerFour(String falseAnswerFour)	{
		this.falseAnswerFour = falseAnswerFour;
	}
	public String getFalseAnswerFour()	{
		return falseAnswerFour;
	}
	public String getAnswer(int answerIndex, int orderedListIndex)	{
		switch(answerIndex)	{
		case 0:
			correctAnswer = orderedListIndex;
			return answer;
		case 1:
			return falseAnswerOne;
		case 2:
			return falseAnswerTwo;
		case 3:
			return falseAnswerThree;
		case 4:
			return falseAnswerFour;
		}
		return null;
	}
	public void addRandomizedAnswer(String answer)	{
		if (randomizedAnswers==null)
			randomizedAnswers = new ArrayList<String>();
		randomizedAnswers.add(answer);
	}
	public String getRandomizedAnswer(int index)	{
		return randomizedAnswers!=null?randomizedAnswers.get(index):null;
	}
	public Integer getCorrectAnswer()	{
		return correctAnswer!=null?correctAnswer:null;
	}
}
